<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start();

class mainpage extends CI_Controller 
	{
		function index()
		{
			$this->load->model("admin_model");
			$data['summary'] = (array)$this->admin_model->getSummary();
			/*$_SESSION['username'] = $_POST['username'];
			$username = $_SESSION['username'];
			$this->load->model('user_model');
			$data['user']=$this->user_model->getUserByUsername($username);
			$this->load->view('view_main',$data);
			*/	
			if (isset($_SESSION['username']) )
			{$username = $_SESSION['username'];
				$this->load->model('user_model');
				$data['user']=$this->user_model->getUserByUsername($username);
				$this->load->view('view_main',$data);
			}
			else {
				$this->load->view('view_main',$data);
			}
			
		}
	}
?>
		